//
// Created by LiuYou on 2020/8/2.
//

#ifndef CLASSWITHCOMPOSITION_HAIERHARDDISK_H
#define CLASSWITHCOMPOSITION_HAIERHARDDISK_H


#include <ostream>
#include "ModernHardDisk.h"

namespace ly {
    class HaierHardDisk : public ModernHardDisk {
    private:
        double adapterId;
    public:
        std::string toString() override {
            return ModernHardDisk::toString() +
                   "<-superclass subclass->" +
                   (std::string) "HaierHardDisk{" +
                   "adapterId=" + std::to_string(adapterId) +
                   '}';
        }
//        std::string toString() override {
//            return (std::string) "HaierHardDisk{" +
//                   "adapterId=" + std::to_string(adapterId) +
//                   '}';
//        }

        friend std::ostream& operator<<(std::ostream& os, const HaierHardDisk& disk) {
            os << static_cast<const ModernHardDisk&>(disk) << " adapterId: " << disk.adapterId;
            return os;
        }

        double getAdapterId() const {
            return adapterId;
        }

        void setAdapterId(double adapterId) {
            HaierHardDisk::adapterId = adapterId;
        }

        ~HaierHardDisk() override = default;

        HaierHardDisk(int capacity, int speed, double adapterId = 1.1) : ModernHardDisk(capacity, speed),
                                                                         adapterId(adapterId) {}
    };

}


#endif //CLASSWITHCOMPOSITION_HAIERHARDDISK_H
